// -----------------------------------------------------------------------
// <copyright file="MasterPage.master.cs" company="Imar.Spaanjaars.Com">
//   Copyright 2008 - 2009 - Imar.Spaanjaars.Com. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MasterPages_MasterPage : System.Web.UI.MasterPage
{
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!IsPostBack)
		{
			if (Request.Cookies.Get("PrefLang") != null)
			{
				ListItem myItem = lstSelectLanguage.Items.FindByValue(Request.Cookies.Get("PrefLang").Value);
				if (myItem != null)
				{
					myItem.Selected = true;
				}
			}
		}
	}

	protected void lstSelectLanguage_SelectedIndexChanged(object sender, EventArgs e)
	{
		HttpCookie myCookie = new HttpCookie("PrefLang");
		myCookie.Expires = DateTime.Now.AddMonths(2);
		myCookie.Value = lstSelectLanguage.SelectedValue;
		Response.Cookies.Add(myCookie);
		Response.Redirect(Request.Url.ToString());
	}
}
